package com.zmj.sy.mom.srv.aps.bean.vo.aps;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.utils.MkBeanUtils;
import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;

import java.util.List;
import java.util.stream.Collectors;

@Getter
@Setter
public class HexagonOrderListResVo<T> extends BaseResVo {

    private List<T> data;

    private String errorMsg;

    private String selectVal;

    public HexagonOrderListResVo(List<T> data) {
        this.data = data;
    }

    @SneakyThrows
    public static <T> HexagonOrderListResVo<T> of(List<?> shiftPage, Class<T> clazz) {
        List<T> l = shiftPage
                .stream()
                .map(e -> MkBeanUtils.copyProperties(e, clazz))
                .collect(Collectors.toList());
        return new HexagonOrderListResVo<>(l);
    }


}
